//
//  NSString+base64.m
//  SECRET
//
//  Created by Jessica_ios1 on 15/12/24.
//  Copyright © 2015年 Jessica. All rights reserved.
//

#import "NSString+base64.h"
#import "GTMBase64.h"

@implementation NSString (base64)
#pragma mark - base64
+ (NSString*)encodeBase64String:(NSString * )input {
    
    NSData *data = [input dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
    
    NSString* encoded = [[NSString alloc] initWithData:[GTMBase64 encodeData:data] encoding:NSUTF8StringEncoding];
    
    return encoded;
    
}

+ (NSString*)decodeBase64String:(NSString * )input {
    
    return [[NSString alloc] initWithData:[GTMBase64 decodeString:input] encoding:NSUTF8StringEncoding];
    
}

+ (NSString*)encodeBase64Data:(NSData *)data {

    data = [GTMBase64 encodeData:data];
    
    NSString *base64String = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
    
    return base64String;
    
}

+ (NSString*)decodeBase64Data:(NSData *)data {
    
    data = [GTMBase64 decodeData:data];
    
    NSString *base64String = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
    
    return base64String;
    
}


@end
